// Factory Methods


// java subject

var Java = function (content) {
    this.content = content
    (function(content) {
        var div = document.createElement('div');
        div.innerHTML = content;
        div.style.color = 'green';
        document.getElementById('containner').appendChild('div');
    })(content); 
}
// php  subject

var Php = function (content) {
    this.content = content
    (function(content) {
        var div = document.createElement('div');
        div.innerHTML = content;
        div.style.color = 'yellow';
        div.style.background = 'red';
        document.getElementById('containner').appendChild('div');
    })(content); 
}
// php  subject

var JavaScript = function (content) {
    this.content = content
    (function(content) {
        var div = document.createElement('div');
        div.innerHTML = content;
        div.style.color = 'pink';
        document.getElementById('containner').appendChild('div');
    })(content); 
}


// factory methods for subject

function JobFactory (type,content){
    switch(type){
        case 'Java':
            return new Java(content);
        case 'Php':
            return new Php(content);
        case 'JavaScript':
            return new JavaScript(content);
    }
}

// simple safe  factory

var Factory = function(type,content){
    if (this instanceof Factory){
        var s = new this[type](content);
        return s;
    } else {
        return  new Factory(type,content)
    }
}

Factory.prototype = {
    Java: function(content){
        //
    },
    JavaScript: function(content){
        //
    },
    Php: function(content){
        //
    },

}
